package com.gph.saviorframework.mq.client.test;

import com.gph.saviorframework.mq.api.Action;
import com.gph.saviorframework.mq.api.ConsumeContext;
import com.gph.saviorframework.mq.api.Message;
import com.gph.saviorframework.mq.api.MessageListener;

/**
 * Created by root on 16-7-19.
 */
public class DemoMessageListener implements MessageListener {
    /**
     * 消费消息接口，由应用来实现<br>
     *
     * @param message 消息
     * @param context 消费上下文
     * @return 消费结果，如果应用抛出异常或者返回Null等价于返回Action.ReconsumeLater
     */
    public Action consume(Message message, ConsumeContext context) {
        System.out.println("-->" + new String(message.getBody()));
        return Action.CommitMessage;
    }
}
